package com.wisdudu.blank.support.view;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.ProgressBar;

/**
 * 自定义进度条,可以递增的.
 */
public class ProgressBarIncreasing extends ProgressBar {
    int i=0;
    public ProgressBarIncreasing(Context context) {
        super(context);
    }

    public ProgressBarIncreasing(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public ProgressBarIncreasing(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    /**
     *
     * @param progress   进度条的progress
     * @param delayedTime  延时秒数
     */
    public void starRun(final int progress,final long delayedTime){
        i=0;
        while (i<progress){
            try {
                i++;
                ProgressBarIncreasing.this.setProgress(i);
                Thread.sleep(delayedTime);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }

    }

}
